<?php
include "connect.php";
$date=$_POST['date'];
//$mt_id=$_POST['mt_id'];
$class_id=$_POST['class_id'];
$subject_id=$_POST['subject_id'];
$total_marks=$_POST['total_marks'];
$teacher_id=$_POST['teacher_id'];
$sess=$_POST['sess'];

$dbquery="INSERT INTO monthly_test (date,class_id,subject_id,total_marks,teacher_id) VALUES ('$date','$class_id','$subject_id','$total_marks','$teacher_id')";

mysql_query($dbquery);
$mt_id = mysql_insert_id();


$sql2=mysql_query("select * from student_subject where session_id=' $sess' AND class_id='$class_id' AND subject_id='$subject_id'" );


while($row=mysql_fetch_array($sql2))
{
$roll=$row['roll_no'];
$marks=$_POST[$roll];


$sql=mysql_query("insert into monthly_test_detail (mt_id,roll_no,obtain_marks) VALUES ('$mt_id','$roll','$marks')");
}
header("location:monthly test tea.php");

?>